#include<bits/stdc++.h>
#define int long long
using namespace std;

int T, a, b; 

int f(int x) {
	return x > 0 ? x : -x;
}
void Sol() {
	cin >> a >> b;
	if(a > b) swap(a, b);
	if(a <= 0 && b >= 0) {
		cout << min(f(a + b), min(f(a), f(b))) << endl;
		return;
	} 
	cout << 0 << endl;
}
signed main() {
	freopen("sub.in", "r", stdin);
	freopen("sub.out", "w", stdout);
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

	cin >> T;
	while(T--) Sol();

	return 0;
}
